<%
function pagination(pagecount,pagesize,pagenumber,pagecategory)
    Dim query, a, x, temp
    action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
    query = Split(Request.ServerVariables("QUERY_STRING"), "&")
	For Each x In query
        a = Split(x, "=")
        If StrComp(a(0), pagecategory, vbTextCompare) <> 0 Then
            temp = temp & a(0) & "=" & a(1) & "&"
        End If
    Next
    Response.Write("<form method=get onsubmit=""document.location = '" & action & "?" & temp & pagecategory & "='+this."&pagecategory&".value;return false;"">")
	if pagenumber<=1 then
        Response.Write ("<span class='white' style='display:none'>[首页] [上一页] </span>")
    else
        Response.Write("<span class='white'>[<a href=" & action & "?" & temp & pagecategory & "=1 class='white'>首页</a>] ")
        Response.Write("[<a href=" & action & "?" & temp & pagecategory & "=" & (pagenumber-1) & " class='white'>上一页</a>] </span>")
    end if
    if pagenumber>=pagecount or pagecount=0 then
        Response.Write ("<span class='white' style='display:none'>[下一页] [尾页] </span>")
    else
	    Response.Write("<span class='white'>[<a href=" & action & "?" & temp & pagecategory & "=" & (pagenumber+1) & " class='white'>下一页</a>] ")
        Response.Write("[<a href=" & action & "?" & temp & pagecategory & "=" & pagecount & " class='white'>尾页</a>] </span>")
	end if
	if pagenumber=-1 then 
		Response.Write("<span class='white'>第 0 页 / 共 0 页")
		'Response.Write(" ["&pagesize & "条/页]")
		Response.Write(" 转到" & "<input name='"&pagecategory&"' size='2' value='0' />" & "页<input type='submit' value='Go' disabled='disabled' /></span>")
	else
		Response.Write("<span class='white'>第 " & pagenumber & " 页 / 共 " & pageCount &" 页")
		'Response.Write(" ["&pagesize & "条/页]")
		Response.Write(" 转到" & "<input name='"&pagecategory&"' size='2' value='" & pagenumber & "' />" & "页<input type='submit' value='Go' /></span>")
	end if
	response.Write("</form>")
End function
%>
